<?php
namespace Home\Controller;
use Think\Controller;
class CommentController extends Controller{
	public function _initialize(){
		if($_COOKIE["manager_id"] == null){
			$index = new IndexController();
			$index->login();exit;
		}
	}
	
	public function index(){
		
	}
	public function showComment(){
		$this->display();
	}
	public function getComment(){
		$sql="select c.content,c.create_time,u.username from comment as c left join user as u on c.user_id = u.id";
		$comment = M("Comment")->query($sql);
		for($i=0;$i<count($comment);$i++){
			$comment[$i]["create_time"] = date("Y年m月d日",$comment[$i]["create_time"]);
		}
		echo json_encode($comment);
	}
}